<?php
// Test of R0910CMS
// created by TLightSky
// time : 20100404
include_once TEST_ROOT."testMappingDbModel".SEP."Mappingtest.php";
class ToolkitTest extends UnitTestCase {
	private $_m;
	private $_db;
	function testMappingDbModel() {
		$eq  = 'assertEqual';
		$newTable= new Mappingtest($this->_db);
		$newTable->create();
		$this->_m->mappingDbModel($this->_db,TEST_ROOT."testMappingDbModelTarget".SEP);
		$oldFile=file_get_contents(TEST_ROOT."testMappingDbModel".SEP."Mappingtest.php");
		$newFile=file_get_contents(TEST_ROOT."testMappingDbModelTarget".SEP."Mappingtest.php");
		$ignoreDate = '/\d\d\d\d-\d\d-\d\d/';
		$oldFile = preg_replace($ignoreDate,'',$oldFile);
		$newFile = preg_replace($ignoreDate,'',$newFile); 
		$this->$eq($oldFile,$newFile);
		$newTable->drop();
	}
	function setUp()
	{
		$this->_m = getInstance("R_Toolkit_DbModelMapping");
        $this->_db  = R_Db_Manage::get('goodlink');
        // as it will be run 6 times or i will use setInstance to setUp it
        // althrough I use the full param all the times,it make sence only in first time
        $this->_db->setNames('gbk');
		R_Data::set("common","sitepre","t_");
	}
}
